Northwoods.GoSilverlight 2.1.1 Assembly
AddCollectionCopy Method
See Also  Send Feedback
Northwoods.GoXam.Model Namespace > GraphModel<NodeType,NodeKey> Class : AddCollectionCopy Method

coll
the collection of data to be copied
env
the ICopyDictionary used to keep track of copied objects; if null, the method will call CreateCopyDictionary, use it, and return it

Glossary Item Box

Copy existing node data and add to this model.

Syntax

Visual Basic (Declaration) 
Public Function AddCollectionCopy( _
   ByVal coll As GraphModel(Of NodeType,NodeKey), _
   ByVal env As GraphModel(Of NodeType,NodeKey) _
) As GraphModel(Of NodeType,NodeKey)

Parameters

coll
the collection of data to be copied
env
the ICopyDictionary used to keep track of copied objects; if null, the method will call CreateCopyDictionary, use it, and return it

Return Value

the updated copy dictionary, mapping original data to copied data

Remarks

The primary purpose of this method is to perform a two-pass copy of a part of a diagram, and add the resulting data to this model.

Of course you can add data without copying them by calling AddNode or by just adding them directly to the NodesSource.

This calls Northwoods.GoXam.Model.GraphModel`2.AugmentCopyCollection(Northwoods.GoXam.Model.GraphModel{`0,`1}.DataCollection) on the source model to allow it to extend the collection to include parts that it thinks should be in the collection.

Then it calls Northwoods.GoXam.Model.GraphModel`2.AugmentCopyDictionary(Northwoods.GoXam.Model.GraphModel{`0,`1}.CopyDictionary) on this, the destination model, to allow it to prepopulate the GraphModel.CopyDictionary<NodeType,NodeKey> if it wants to guide the copying process to control the sharing of references in the copied parts.

The first pass copies all of the nodes that are not already in the env copy dictionary, by calling Northwoods.GoXam.Model.GraphModel`2.CopyNode1(`0,Northwoods.GoXam.Model.GraphModel{`0,`1}.CopyDictionary). If the call returns a node data, it is added to this model by calling AddNode and remembered in the env copy dictionary, mapped to the original node data.

The second pass fixes up references in all of the copied nodes by calling Northwoods.GoXam.Model.GraphModel`2.CopyNode2(`0,Northwoods.GoXam.Model.GraphModel{`0,`1}.CopyDictionary,`0,`0,System.Collections.Generic.IEnumerable{`0},System.Collections.Generic.IEnumerable{`0},System.Collections.Generic.IEnumerable{`0}). It passes as arguments both the original node data and the copied node data, as well as the newly copied group node, if any, and a list of member nodes.

Requirements

See Also

© 2013 All Rights Reserved.